package com.lagou.mapper;

import com.lagou.pojo.User;
import org.apache.ibatis.annotations.Result;
import org.apache.ibatis.annotations.Results;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * @Authther: mrwu
 * @date:2021/3/21-03
 * @Description:com.lagou.mapper
 */

public interface UserMapper {
@Results({
        @Result(id = true,column = "id", property = "id"),
        @Result(column = "name",property = "name"),
        @Result(column = "age",property = "age"),
        @Result(column = "email",property = "email"),
        @Result(column = "adress",property = "adress"),
})
@Select("select * from user")
List<User> selectAll();
@Results({
        @Result(id = true,column = "id", property = "id"),
        @Result(column = "name",property = "name"),
        @Result(column = "age",property = "age"),
        @Result(column = "email",property = "email"),
        @Result(column = "adress",property = "adress"),
})
@Select("select * from user where id = #{id}")
User findById(Integer id);
//通过用户名查询信息
@Results({
        @Result(id = true,column = "id", property = "id"),
        @Result(column = "name",property = "name"),
        @Result(column = "age",property = "age"),
        @Result(column = "email",property = "email"),
        @Result(column = "adress",property = "adress"),
})
@Select("select * from user where name =#{name}")
List<User> findByUserName(String name);

}

